package com.cqemme.messageservice.controller;

import com.alibaba.fastjson.JSONObject;
import com.cqemme.comm.enums.EnumNote;
import com.cqemme.comm.po.NoteMessage;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Controller
@RequestMapping("/test")
@CrossOrigin
@Api(value = "自己的测试控制器")
public class TestController {

    @Autowired
    private AmqpTemplate amqpTemplate;

    @RequestMapping(value = "/test",method = RequestMethod.POST)
    @ResponseBody
    public Object login(@RequestBody NoteMessage note) {
        //组装发送短信数据school-system-note @RequestBody NoteMessage note
        note.setType(EnumNote.EARLY_WARNING);
        //amqpTemplate.convertAndSend("school-system-note", JSONObject.toJSONString(note));
        return "kkkkk";
    }
}
